package com.ipodget
/**
 * @author pguedes
 */
public class Settings{
    private static final String LAST_MP_FILENAME = '.ipod-get-lmp'
    private static final String USER_HOME_PATH = System.getProperty('user.home')
    
    private Settings(){
        // factory
    }
    
    /**
     * <p>Get the last known mount point of the ipod</p>
     */
    public static final File getLastKnownMountPoint(){
        def propertyFile = new File(USER_HOME_PATH, LAST_MP_FILENAME)
        if(!propertyFile.exists()){
            return null
        }
        return new File(propertyFile.text)
    }
     
    public static final void setLastKnownMountPoint(File path){
        new File(USER_HOME_PATH, LAST_MP_FILENAME).withWriter { writer ->
            writer.write path.absolutePath
        }
    }     
}
